package com.nmm.stream.bean;
import com.nmm.stream.bean.annotation.ExceptionHandler;
import com.nmm.stream.bean.annotation.Order;

/**
 * @author nmm
 * @date 2024-04-2024/4/12
 * @deriction njm......
 */
public class UserService {

    /**
     * 用于存放order注解的数字
     */
    private   int myOrder;

    private  String methodName;

    private  Class<?> myClazz;

    public UserService(int myOrder,String methodName) {
        this.myOrder = myOrder;
        this.methodName=methodName;
    }

    public UserService(String methodName,Class<?> myClazz) {
        this.methodName=methodName;
        this.myClazz = myClazz;
    }

    public  int getMyOrder() {
        return myOrder;
    }

    public Class<?> getMyClazz() {
        return myClazz;
    }

    @ExceptionHandler(Exception.class)
    @Order(4)
    public void methodA(){}

    @ExceptionHandler(IllegalArgumentException.class)
    @Order(2)
    public void methodB(){}

    @ExceptionHandler(RuntimeException.class)
    @Order(3)
    public void methodC(){}

    @ExceptionHandler(IllegalThreadStateException.class)
    @Order(1)
    public void methodD(){}


    @Override
    public String toString() {
        return "UserService{" +
                "myOrder=" + myOrder +
                ", methodName='" + methodName + '\'' +
                ", myClazz=" + myClazz +
                '}';
    }
}